<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>对象的简化写法</title>
</head>
<body>
    
</body>

<script>
    //ES6 允许在大括号里面，直接写入变量和函数，作为对线的属性和方法。
    let name = `张三`;
    let say = function(){
        console.log(name);
    }
    let prosen = {
        name,
        say,
        //简化重复 :name 以及function书写
        play(){
            console.log(`我能够玩耍`);
        }
    }
    
    prosen.say();
    prosen.play();

</script>

</html>